<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@include file="/context/mytags.jsp" %>
<t:base type="jquery,easyui,tools"/>
<div class="easyui-layout" fit="true" id="main_ad_list" style="width: 60%">
    <div region="center" style="padding:1px;">
        <t:datagrid name="questList" title="" actionUrl="questController.do?select_datagrid" idField="id" fit="true"
                    queryMode="group" checkbox="false" >
            <t:dgCol title="主键" field="id" hidden="true"></t:dgCol>
            <t:dgCol title="量表名称" field="name" width="2" query="true"></t:dgCol>
            <t:dgCol title="量表分类" field="questSortEntity.name" width="1" query="true"></t:dgCol>
            <t:dgCol title="所属平台" field="platformEntity.name" width="1" query="true"></t:dgCol>
            <%--<t:dgCol title="背景图片" field="backgroud" image="true" imageSize="200,100" width="2"></t:dgCol>--%>
            <%--<t:dgCol title="创建时间" formatter="yyyy-MM-dd hh:mm:ss" field="createTime"></t:dgCol>--%>

            <%--<t:dgCol title="common.operation" field="opt" width="1"></t:dgCol>--%>
            <%--<t:dgDelOpt url="questController.do?del&id={id}" title="删除"></t:dgDelOpt>--%>
            <%--<t:dgFunOpt funname="showQuesQues(id,name)" title="量表问题"></t:dgFunOpt>--%>
            <%--<t:dgFunOpt funname="f_importTemplate(id)" title="导入模版"></t:dgFunOpt>--%>

            <%--<t:dgToolBar title="新增" icon="icon-add" url="questController.do?addorupdate" funname="add" width="600"--%>
            <%--height="550"></t:dgToolBar>--%>
            <%--<t:dgToolBar title="修改" icon="icon-edit" url="questController.do?addorupdate" funname="f_updateInfo"--%>
            <%--width="600" height="550"></t:dgToolBar>--%>
            <%--<t:dgToolBar title="详情" icon="icon-search" url="questController.do?detail" funname="f_detail" width="600"--%>
            <%--height="550"></t:dgToolBar>--%>

        </t:datagrid>
    </div>
</div>
<div style="display: none">
    <t:formvalid formid="formobj" layout="div" dialog="true" action="questController.do?importing&id=${qsId}"
                 beforeSubmit="setIds">
        <input id="ids" name = "ids" type="text"  value=""/>
    </t:formvalid>
</div>
<%--<div region="east" split="true">--%>
<%--<div tools="#tt" class="easyui-panel" title='量表问题' style="padding: 10px;"--%>
<%--fit="true" border="false" id="function-panel"></div>--%>
<%--</div>--%>
<%--<div id="tt"></div>--%>
<%--</div>--%>
<script type="text/javascript">
    function showQuesQues(id, name) {
        $("#function-panel").panel(
                {
                    title: name,
                    href: "quesquesController.do?index&id=" + id
                }
        );
        $('#function-panel').panel("refresh");

    }
    $(function () {
        var li_east = 0;
    });

    //组合选中的模版id
    function setIds() {
        var rows = $('#questList').datagrid('getSelections');
        if (rows.length ==0) {
            tip("请先选择需要的模版。");
            return false;
        } else {
            var ids = "";
            for (var i = 0; i < rows.length; i++) {
                ids += rows[i].id;
                if (i != rows.length - 1)
                    ids += ",";
            }
            $("#ids").val(ids);
            return true;
        }
    }

    //关闭当前窗口
    function f_closeWindow() {
        frameElement.api.close();
    }

    function f_updateInfo(title, url, id, width, height) {
        gridname = id;
        var rowsData = $('#' + id).datagrid('getSelections');
        if (!rowsData || rowsData.length == 0) {
            tip('请选择编辑量表');
            return;
        }
        if (rowsData.length > 1) {
            tip('请选择一条量表再编辑');
            return;
        }

        url += '&id=' + rowsData[0].id;
        createwindow(title, url, width, height);
    }

    function f_detail(title, url, id, width, height) {
        gridname = id;
        var rowsData = $('#' + id).datagrid('getSelections');
        if (!rowsData || rowsData.length == 0) {
            tip('请选择量表');
            return;
        }
        if (rowsData.length > 1) {
            tip('请选择一条量表再查看');
            return;
        }

        url += '&id=' + rowsData[0].id;
        createwindow(title, url, width, height);
    }

    //查看
    function f_detail(title, url, id, width, height) {
        gridname = id;
        var rowsData = $('#' + id).datagrid('getSelections');
        if (!rowsData || rowsData.length == 0) {
            tip('请选择量表');
            return;
        }
        if (rowsData.length > 1) {
            tip('请选择一个量表');
            return;
        }
        url += '&id=' + rowsData[0].id;
        title = "咨询师预览";
        createdetailwindow(title, url, width, height);
    }



</script>
